package site.shihuan.helpdesk.service.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.shihuan.helpdesk.common.model.RestResult;
import site.shihuan.helpdesk.common.model.RestResultUtils;
import site.shihuan.helpdesk.security.annotation.Inner;
import site.shihuan.helpdesk.service.dao.SvcClerkDao;
import site.shihuan.helpdesk.service.model.po.SvcClerkPO;
import site.shihuan.helpdesk.service.model.vo.ClerkVO;

/**
 * Clerk API
 *
 * @author 周世焕
 * @Date 2021/3/20 18:46
 */
@RestController
@RequestMapping("/v1/service/clerk")
public class ClerkController {

    @Autowired
    private SvcClerkDao clerkDao;

    @PostMapping
    public RestResult create(@RequestBody SvcClerkPO clerkPO) {
        if(clerkDao.selectByPrimaryKey(clerkPO.getClerkId())!=null) {
            clerkDao.updateByPrimaryKeySelective(clerkPO);
        }else {
            clerkDao.insertSelective(clerkPO);
        }
        return RestResultUtils.success();
    }
}
